#!/usr/bin/env bash

# 给所有用户读权限和执行权限
chmod 755 script.sh

# bash演示脚本

# echo命令
echo "hello\nworld"
# 使用-n去掉结尾的回车符
echo "hello\nworld" -n
# 使用-e对特殊字符进行转义
echo "hello\nworld" -e

# 命令组合符
echo "hello&&" && echo "world"
echox "hello||" || echo "world"
echo "hello;" ; echo "world"

# type
type echo
type -a echo
type -t echo

# 扩展模式

# ~扩展
echo ~
echo ~/home
echo ~user
echo ~root
# ?扩展
echo a?.txt
echo a?c.txt
# *扩展
echo a*.txt
echo .*
echo .[!.]*
echo */*a.txt
echo **/*a.txt
# []扩展
echo a[123]c.txt
echo a[!123]c.txt
echo a[-123]c.txt
# [start-end]扩展
echo [a-d]*.txt
echo [!a-d]*.txt
# {...}扩展
echo {1,2,3,4}.txt
echo {a1,a2,a3,a4}.txt
# {start-end}扩展
echo {1..10}
echo {01..10}
mkdir {2021..2029}_{01..12}
echo {01..10..3}
echo {01..10..3}{a..c}
# 变量扩展
echo $shell
echo ${shell}
echo ${!s*}
# 子命令扩展
echo $(date) 
echo `date`
# 算术扩展
echo $((25*4-50+6))
# 字符类扩展
echo [[:alpha:]]*.txt
echo [![:alpha:]]*.txt
# 量词语法
echo shopt extglob
echo +(*a).txt



exit 0



